package at.spengergasse.model;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

public class PlzTest
{
	private final int plz = 1050;
	private final String ort = "Wien";

	Plz p = new Plz(plz, ort);

	@Test
	public void testPlzCorrect()
	{
		new Plz(plz, ort);
	}

	@Test(expected = IllegalArgumentException.class)
	public void testSetPlzToShort()
	{
		p.setPlz(999);
	}

	@Test(expected = IllegalArgumentException.class)
	public void testSetPlzToLong()
	{
		p.setPlz(10000);
	}

	@Test(expected = IllegalArgumentException.class)
	public void testSetOrtEmpty()
	{
		p.setOrt("   ");
	}

	@Test(expected = IllegalArgumentException.class)
	public void testSetOrtNull()
	{
		p.setOrt(null);
	}

	@Test(expected = IllegalArgumentException.class)
	public void testSetOrtToLong()
	{
		p.setOrt("abcdefghijklmnopqrstuvwxyzvienna1");
	}

	@Test
	public void testSetOrt30()
	{
		p.setOrt("abcdefghijklmnopqrstuvwxyzwien");
	}

	@Test
	public void testGetPlz()
	{
		Plz p1 = new Plz(plz, ort);
		assertTrue(plz == p1.getPlz());
	}

	@Test
	public void testGetOrt()
	{
		Plz p1 = new Plz(plz, ort);
		assertTrue(ort == p1.getOrt());
	}

}
